﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CruzDelSur.Models.ContratosModel>" %>
<%@ Import Namespace="CruzDelSur.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
 Editar contrato
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ModuleTitleContent" runat="server">
   Servicios especiales / Contrato
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentMenuSecundario" runat="server">
    <% Html.RenderPartial("Servicios/MenuPrincipal"); %>
</asp:Content>


<asp:Content ID="Content5" ContentPlaceHolderID="MainContent" runat="server">
<% Html.RenderPartial("Servicios/MenuSecundarioProyEspeciales", new { Action = "Contratos"});%>
<ul class="tabs secondary">
 <li><a href="<%:Url.Action("Contratos", "ServiciosEspeciales") %>" class="">Listar</a></li>
 <li><a href="<%:Url.Action("CrearContrato", "ServiciosEspeciales") %>" class="active">Crear</a></li>
</ul>
<h2 style="font-size: medium">Crear / Modificar Contrato</h2>
 <%: Html.ValidationSummary(true)%>
     <% using (Html.BeginForm())
        {%>  
    <div class="span-12" 
         style="font-family: Arial, Helvetica, sans-serif; font-size: small">
    <p>
        <label>N° Contrato </label> <%: Html.TextBoxFor(model => model.Contrato.Codigo) %> <br />
        <label>Solicitante </label>  <%: Html.DropDownListFor(m=>m.Contrato.Cliente.Codigo, Model.Clientes) %> <br />
        <label>Descripción</label> <%: Html.TextBoxFor(model => model.Contrato.Descripcion) %> <br />
     </p>
    </div>
    <div class="span-8" 
         style="font-family: Arial, Helvetica, sans-serif; font-size: small"> 
    <p style="width: 310px">
        <label>Fecha Contrato</label> <%: Html.TextBoxFor(model => model.Contrato.FechaInicioContrato) %> <br />
        <label>Fin Contrato</label> <%: Html.TextBoxFor(model => model.Contrato.FechaFinContrato) %> <br />
        <label>Estado</label>&nbsp;<%: Html.TextBoxFor(model => model.Contrato.Estado) %>
     </p>
    </div>
     <div class="span-24">     
    <table id="tableMain">
        <thead>
        <tr>
        <th>Servicio</th>
        <th>Frec.</th>
        <th>Hora</th>
        <th>Cant Pjs</th>
        <th>% ajuste</th>
        <th>Clausula</th>
        <th>Dir Org</th>
        <th>Dir Dst</th>
        <th>Elm.</th>
        </tr>
        </thead>
        <tbody>
        <% 
            if (Model.Detalle != null)
            {
                foreach (var item in Model.Detalle)
                {
                    Html.RenderPartial("DetalleContratoItem", item);
                }
            }%>
        </tbody>
    </table>
    <div class="span-24" align="right"><button type="button" id="agregarNuevoItem">Agregar detalle</button></div>
    </div>
    <div class="span-24" id="toolbar">
<input type="submit" value="Grabar" /> 
<input type="button" value="Cancelar" onclick="location='/ServiciosEspeciales/Contratos'" />
</div>
<% } %>
<script language="javascript" type="text/javascript">
    $('#agregarNuevoItem').click(function () {
        $(this).attr('disabled', 'disabled');
        $.get('<%:Url.Action("AdicionarContratoDetalleItem", "ServiciosEspeciales")%>', function (row) {
            $("#tableMain > tbody").append(row);
            $('#agregarNuevoItem').attr('disabled', '');
            setTimeout(refreshUI, 500);
        });
    });
    $('.numeric').numeric({ decimal: "<%:Html.separadorNumeroDecimal()%>" });
</script>
</asp:Content>
